<%-- 
    Document   : UserProfiles
    Created on : Apr 2, 2014, 4:26:05 AM
    Author     : asmaa
--%>

<%@include file="headerAdmin.jsp" %>
        <script>
            function gotoUser(id)
            {
                location.href = "UserProfileView.jsp?id="+id;
            }
        </script>
        
        <sql:query dataSource="${conn}" var="result">
            SELECT id,name,email from User;
        </sql:query>
            
        <div class="top_bg">
            <div class="wrap">
                <div class="main_top">
                    <h2 class="style">All Users</h2>
                </div>
            </div>
        </div>
        <div class="container">
            <div class="row">
                <div class="col-md-6" style="margin-left: 60px;margin-top: 20px">
                    <div class="main_top">
                        <table class="table table-bordered table-hover">
                            <tr>
                                <th>Name</th>
                                <th>email</th>
                                <th>View</th>
                            </tr>
                            <c:forEach var="row" items="${result.rows}">
                                <tr>
                                    <td>
                                        <c:out value="${row.name}"/>
                                    </td>
                                    <td>
                                        <c:out value="${row.email}"/>
                                    </td>
                                    <td>
                                        <button type="button" class="btn btn-success btn-sm" onclick="gotoUser(<c:out value="${row.id}"/>)">View</button>
                                    </td>
                                </tr>
                            </c:forEach>
                        </table>
                    </div>
                </div>
            </div>
        </div>
     <%@ include file="footer.jsp" %>
